<?php
/**
 * @package Autogenerator for Joomla!
 * @version 3.0.0
 * @author Truong Cong Duc <truongcongduc4@gmail.com>
 * @link autogenerator.blogspot.com
 * @copyright (c) 2013, Truong Cong Duc
 * @license GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

class AutogeneratorViewField extends JViewLegacy {

    protected $form;
    protected $item;
    protected $state;

    public function display($tpl = null) {
        $this->form = $this->get('Form');
        $this->item = $this->get('Item');
        $this->state = $this->get('State');

        $this->addToolbar();

        parent::display($tpl);
    }

    protected function addToolbar() {
        $oApp = JFactory::getApplication();
        
        $oApp->input->set('hidemainmenu', true);
        $sLayout = $oApp->input->get('layout');

        switch ($sLayout) {
            case 'edit':
                JToolbarHelper::apply('field.apply');
                JToolbarHelper::save('field.save');
                JToolbarHelper::save2new('field.save2new');
                break;

            case 'check':
                break;

            case 'review':
                break;

            default:
                break;
        }

        JToolbarHelper::title(JText::_('COM_AUTOGENERATOR_FIELD_DETAILS'), 'article.png');

        JToolbarHelper::cancel('field.cancel');
    }

}
